package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 抵消错误
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_23 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		//从左到友计算和   从右到左计算和
		double sum1=0;
		double sum2=0;
		for(int i=50000;i>0;i--) {
			sum1+=1.0/(double)i;
			sum2+=1.0/(double)(50000-i+1);
		}
		System.out.print("From left to right is:"+sum1+"\nFrom right to left is:"+sum2+"\n");
		
		
	}

}
